home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / utility / toupper.c < prev    next >
C/C++ Source or Header  |  1996-09-13  |  2KB  |  87 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: toupper.c,v 1.2 1996/09/13 17:16:35 digulla Exp $
  4.     $Log: toupper.c,v $
  5.     Revision 1.2  1996/09/13 17:16:35  digulla
  6.     Removed the macro TOUPPER. Use this library function instead
  7.  
  8.     Revision 1.1  1996/08/31 12:58:13  aros
  9.     Merged in/modified for FreeBSD.
  10.  
  11.  
  12.     Desc:
  13.     Lang: english
  14. */
  15. #include <exec/types.h>
  16. #include <aros/libcall.h>
  17. #include "utility_intern.h"
  18.  
  19. /*****************************************************************************
  20.  
  21.     NAME */
  22.     #include <clib/utility_protos.h>
  23.  
  24.     __AROS_LH1I(UBYTE, ToUpper,
  25.  
  26. /*  SYNOPSIS */
  27.     __AROS_LHA(unsigned long, character, D0),
  28.  
  29. /*  LOCATION */
  30.     struct UtilityBase *, UtilityBase, 29, Utility)
  31.  
  32. /*  FUNCTION
  33.     Convert a character to uppercase
  34.  
  35.     INPUTS
  36.     character   - The character that you want changed.
  37.  
  38.     RESULT
  39.     The uppercase version of that character.
  40.  
  41.     NOTES
  42.     Currently only works for ASCII characters. Would not be difficult
  43.     to adapt for other character sets (Unicode for example).
  44.  
  45.     This function is patched by the locale.library, so you should be
  46.     prepared for different results when running under different
  47.     languages.
  48.  
  49.     EXAMPLE
  50.     STRPTR string; UBYTE chr;
  51.  
  52.     \* Convert a string to uppercase *\
  53.     while( chr = *string )
  54.     {
  55.         *string = ToUpper( chr );
  56.         string++;
  57.     }
  58.  
  59.     BUGS
  60.  
  61.     SEE ALSO
  62.     utility/ToLower()
  63.  
  64.     INTERNALS
  65.     This function is patched by locale.library.
  66.  
  67.     HISTORY
  68.     29-10-95    digulla automatically created from
  69.                 utility_lib.fd and clib/utility_protos.h
  70.     10-08-96    iaint   Created from tolower.c from AROSdev15
  71. *****************************************************************************/
  72. {
  73.     __AROS_FUNC_INIT
  74.  
  75.     return
  76.     (
  77.     (character >= 'a' && character <= 'z')
  78.     || (character >= 0xE0
  79.         && character <= 0xEE
  80.         && character != 0xE7)
  81.     ? character - 0x20
  82.     : character
  83.     );
  84.  
  85.     __AROS_FUNC_EXIT
  86. } /* ToLower */
  87.